package com.goblin.model.order.po;

import com.goblin.model.base.BaseEntity;
import lombok.Data;

import javax.persistence.*;
import java.util.List;

@Data
@Table(name = "t_goods_spec")
@Entity
public class Spec extends BaseEntity {

    @Column(name = "spec_name", columnDefinition = "varchar(255) COMMENT '规格名称'")
    private String specName;

    @Column(name = "spec_no", columnDefinition = "varchar(255) COMMENT '规格编号'")
    private String specNo;

    @OneToMany(cascade = CascadeType.MERGE, fetch = FetchType.EAGER)
    @JoinTable(name = "t_goods_combine_spec_value", joinColumns = @JoinColumn(name = "specification_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "specVaue_id", referencedColumnName = "id"), foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT))
    private List<Spec> specValues;
}
